package edu.sctu.renpingan.day20150526.stringway;

/**
 * Created by user18 on 2015/5/26.
 */
public class StringWays {
    public String string = "English";

    public String equals() {
        if (string.equals("English")) {
            System.out.println(string);
        }
        return string + string;
    }

    public int lenth() {
        int stringlenth = string.length();
        System.out.println(stringlenth);
        return stringlenth;

    }

    public String substring(int a, int b) {
        String stirng00;
        stirng00 = string.substring(a, b);
        System.out.println(stirng00);
        return stirng00;
    }

    public char charAt() {
        char char2;

        char2=string.charAt(0);
        System.out.println(char2);
        return char2;
    }
    public int indexOf(){         //查找字符串指定字母的位置   参数的意思是从哪里开始
        int dressg = string.indexOf("g",0);
        System.out.println(dressg);
        return dressg;
    }
    public int lastIndexOf(){     //指出指定字符的位置
        int dressE = string.lastIndexOf("");  //如果""(为空)则返回字符串的长度
        System.out.println(dressE);
        return dressE;
    }
    public String replace (){     //将oldchar替换成newchar
        String string22;
        string22 = string.replace("E","e");
        System.out.println(string22);
        return string22;
    }
    public String[] Split(){  //]将字符串分割成单个的字符数组，如果加上某个字母则以它为界限
        String[] strings;
        strings = string.split("");
        for (int i = 0; i < strings.length; i++) {
            System.out.println(strings[i]+"\t");
        }
        return strings;
    }
    public String toLowerCase(){  //将字符串中的大写字母换成小写字母
        String string00 ;
        string00 = string.toLowerCase();
        System.out.println(string00);
        return string00;
    }
    public String toUpperCase(){   //将大写换成小写
        String string3;
        string3 = string.toUpperCase();
        System.out.println(string3);
        return string3;
    }
    public String toString(){  //输出数组
        String string4;
        string4 = string.toString();
        System.out.println(string4);
        return string4;
    }
    public String tirm(){
        String strign5 = string.trim();//返回调用字符串对象的一个副本，但是所有起始和结尾的空格都被删除了
        System.out.println(strign5);
        return strign5;
    }
    public String valueOf(){  //将数据类型进行转换
    int number = 666;
        String string8 = String.valueOf(number);
        System.out.println(string8);
        return string8;
    }
}
